<?php 
class news_hits_sales_product_list extends Load_use
{
	private $new = '';
	private $hit = '';
	private $sale = '';
	
	function getBlock()
	{
		$limit = 30;
		$html = '';
		$i = 1;
		$kinds = array( 'new' => 'Новинки', 'hit' => 'Хит продаж', 'sale' => 'Распродажа' );
		foreach( $kinds as $kind => $title )
		{
			$param = array( 'where' => '`'.$kind.'` = 1 AND `price_retail` > 0 AND `pp` IS NOT NULL',
							'order'	=> 'find_in_set(`pp`, "1,2,3,4,5,0")',
							'limit' => $limit );
			$products = getProductList( $param );
			
			foreach( $products['list'] as $product ) {
				if (array_key_exists($product->product_code, $products['presents'])) {
					$present_name = $products['presents'][$product->product_code]['name'];
					$present_url = $products['presents'][$product->product_code]['url'];
				}
				else
					$present_name = $present_url = '';
				
				$this->$kind .= $this->load->block( 'product', array( 'product' => $product, 'present_name' => $present_name, 'present_url' => $present_url ) );
			}
				
			$html .= '	
					<dt class="goods-tabs__title'.( ( $i == 1 ) ? ' selected' : '' ).'">'.$title.'</dt>
					<dd class="goods-tabs__content'.( ( $i == 1 ) ? ' selected' : '' ).'">
						<div class="sliderkit goods-tabs__slider four-goods">
							<div class="sliderkit-nav">
								<div class="sliderkit-nav-clip">
									<ul>
										'.$this->$kind.'
									</ul>
								</div>
								<div class="sliderkit-btn sliderkit-nav-btn sliderkit-nav-prev">
									<a href="#">
										<span>Предыдущая</span>
									</a>
								</div>
								<div class="sliderkit-btn sliderkit-nav-btn sliderkit-nav-next">
									<a href="#">
										<span>Следующая</span>
									</a>
								</div>
							</div>
						</div>
					</dd>
					';
			$i++;
		}
		return'	<div class="goods-tabs">
					<dl class="goods-tabs__inner">'.$html.'</dl></div>';
	}
}